package com.jy.datapipeline.export.controller;

import com.jy.datapipeline.export.service.DataDictionaryService;
import com.jy.datapipeline.export.entity.DataDictionary;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping(value = "/dictionary/")
public class DataDictionaryController {

    @Autowired
    private DataDictionaryService dataDictionaryService;

    /**
     * 查询数据字典
     * @param type
     * @return
     */
    @RequestMapping(value = "/findDataDictionary", method = RequestMethod.GET)
    @ResponseBody
    public Object findDataDictionary(@RequestParam(value = "type", required = true) String type){
        Map<String, Object> result=new HashMap<>();
        List<DataDictionary> list= this.dataDictionaryService.findByType(type);
        result.put("data", list);
        return result;
    }
}
